<template>
  <div style="padding: 40px" v-loading="loading">
    <div
      class="mb20"
      style="font-weight: 700; font-style: normal; font-size: 16px"
    >
      入院诊断
    </div>
    <div style="display: flex; justify-content: space-between">
      <div style="width: 47%; border-right: 1px solid #ccc">
        <span style="display: inline-block; margin-bottom: 7px"
          >中医诊断：</span
        >
        <template v-if="zhongyi && zhongyi.length > 0">
          <div
            v-for="(item, index) in zhongyi"
            :key="item.id"
            style="font-size: 15px"
          >
            <div style="display: flex; padding-left: 30px">
              <span>{{ index + 1 }}、</span>
              <div>
                <div class="r">
                  <div>
                    <span style="display: inline-block">诊断时间：</span
                    ><span>{{ item.diagTime }}</span>
                  </div>
                  <div class="ml50">
                    <span style="display: inline-block">诊断类型：</span
                    ><span>{{ item.diagCat }}</span>
                  </div>
                </div>
                <!-- <div style="margin-top: 7px">
              <span style="display: inline-block">诊断医生：</span
              ><span>{{ item.diagDocDesc }}</span>
            </div>
            <div style="margin-top: 7px">
              <span style="display: inline-block">诊断级别：</span
              ><span>{{
                item.diagCategory == 1 ? "主要诊断" : "次要诊断"
              }}</span>
            </div> -->
                <div style="display: flex; margin-top: 7px">
                  <div>诊断描述：</div>
                  <div>{{ item.diagDesc }}</div>
                </div>
              </div>
            </div>
            <el-divider v-if="index !== zhongyi.length - 1"></el-divider>
          </div>
        </template>
        <div v-else>
          <el-empty :image-size="150" description="暂无数据"></el-empty>
        </div>
        <div
          v-for="item in zhengxing"
          :key="item.id"
          style="font-size: 15px; padding-left: 83px"
        >
          <div style="display: flex; margin-top: 7px">
            <div>证型：</div>
            <div>{{ item.diagDesc }}</div>
          </div>
        </div>
      </div>
      <div style="width: 47%">
        <span style="display: inline-block; margin-bottom: 7px"
          >西医诊断：</span
        >
        <template v-if="xiyi && xiyi.length > 0">
          <div
            v-for="(item, index) in xiyi"
            :key="item.id"
            style="font-size: 15px"
          >
            <div style="display: flex; padding-left: 30px">
              <span>{{ index + 1 }}、</span>
              <div>
                <div class="r">
                  <div>
                    <span style="display: inline-block">诊断时间：</span
                    ><span>{{ item.diagTime }}</span>
                  </div>
                  <div class="ml50">
                    <span style="display: inline-block">诊断类型：</span
                    ><span>{{ item.diagCat }}</span>
                  </div>
                </div>
                <!-- <div style="margin-top: 7px">
              <span style="display: inline-block">诊断医生：</span
              ><span>{{ item.diagDocDesc }}</span>
            </div>
            <div style="margin-top: 7px">
              <span style="display: inline-block">诊断级别：</span
              ><span>{{
                item.diagCategory == 1 ? "主要诊断" : "次要诊断"
              }}</span>
            </div> -->
                <div style="display: flex; margin-top: 7px">
                  <div>诊断描述：</div>
                  <div>{{ item.diagDesc }}</div>
                </div>
              </div>
            </div>

            <el-divider v-if="index !== xiyi.length - 1"></el-divider>
          </div>
        </template>
        <div v-else>
          <el-empty :image-size="150" description="暂无数据"></el-empty>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { admittingDiagInfo } from "@/api/workstation/baseInfo.js";
export default {
  name: "admittingDiagnosis",
  props: ["medicalRecodeNo"],
  data() {
    return {
      admittingDiagList: [],
      loading: true,
      zhongyi: [],
      xiyi: [],
      zhengxing: [],
    };
  },
  created() {
    this.getBaseInfo();
  },
  methods: {
    // 获取详细信息
    getBaseInfo() {
      let params = {
        medicalRecordNo: this.medicalRecodeNo,
        diagType: 3,
      };
      this.loading = true;
      admittingDiagInfo(params).then((res) => {
        console.log("[ res.data ] >", res.data);
        // 中医诊断
        this.zhongyi = res.data.filter((item) => {
          return item.diagCat == "中医";
        });
        // 证型
        this.zhengxing = res.data.filter((item) => {
          return item.diagCat == "证型";
        });
        // 西医诊断
        this.xiyi = res.data.filter((item) => {
          return item.diagCat == "西医";
        });
        this.admittingDiagList = res.data;
        this.loading = false;
      });
    },
  },
};
</script>

<style></style>
